 #ifndef VM_PAGE_H
#define VM_PAGE_H

#include <list.h>
#include "filesys/file.h"
#include "vm/swap.h"
#include "vm/frame.h"

/* A basic page elem, more vars is needed */
struct spt_elem {
	struct thread* owner;
	/* the upage this entry is descrepting */
	uint8_t *upage;
	/* we can get a file ptr directly in load_seg, the following
	 * keeps the file information */
	struct file *fileptr;
	off_t ofs;
	uint32_t read_bytes;
	uint32_t zero_bytes;
	bool writable;

	void *kpage;

	// File mapping information used to record
	bool needclose;
	bool needremove;
	int mapid;

	/* a list elem */
	struct list_elem elem;
};

/* look up the spt to find a entry or return null */
struct list_elem *page_find (void *upage);
#endif
